<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring Boot 自动配置详解</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.6;
            color: #333;
            background-color: #f9fafb;
        }
        .content-wrapper {
            max-width: 1000px;
            margin: 0 auto;
            padding: 0 20px;
        }
        .hero {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
            color: white;
            padding: 5rem 0;
            margin-bottom: 3rem;
            position: relative;
            overflow: hidden;
        }
        .hero::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"><path fill="rgba(255,255,255,0.05)" d="M0 100 L100 0 L100 100 Z"></path></svg>') no-repeat;
            background-size: 100% 100%;
        }
        .hero-title {
            font-family: 'Noto Serif SC', serif;
            font-weight: 700;
            font-size: 3rem;
            margin-bottom: 1rem;
            text-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .hero-subtitle {
            font-size: 1.25rem;
            opacity: 0.9;
            max-width: 700px;
            margin: 0 auto 1.5rem;
        }
        .section-title {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
            font-size: 2rem;
            color: #4f46e5;
            margin: 2.5rem 0 1.5rem;
            position: relative;
            padding-left: 1.5rem;
        }
        .section-title::before {
            content: "";
            position: absolute;
            left: 0;
            top: 0.5rem;
            height: 1.5rem;
            width: 4px;
            background: linear-gradient(to bottom, #4f46e5, #7c3aed);
            border-radius: 2px;
        }
        .subsection-title {
            font-family: 'Noto Serif SC', serif;
            font-weight: 500;
            font-size: 1.5rem;
            color: #4b5563;
            margin: 2rem 0 1rem;
        }
        .card {
            background: white;
            border-radius: 0.5rem;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            padding: 1.5rem;
            margin-bottom: 2rem;
            transition: transform 0.2s, box-shadow 0.2s;
        }
        .card:hover {
            transform: translateY(-2px);
            box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
        }
        .code-block {
            background-color: #1e1e1e;
            color: #d4d4d4;
            border-radius: 0.5rem;
            padding: 1rem;
            margin: 1.5rem 0;
            overflow-x: auto;
            font-family: monospace;
            font-size: 0.9rem;
            line-height: 1.5;
        }
        .code-keyword {
            color: #569cd6;
        }
        .code-annotation {
            color: #dcdcaa;
        }
        .code-string {
            color: #ce9178;
        }
        .code-comment {
            color: #6a9955;
        }
        .feature-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 3rem;
            height: 3rem;
            border-radius: 50%;
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
            color: white;
            margin-right: 1rem;
            flex-shrink: 0;
        }
        .feature-item {
            display: flex;
            margin-bottom: 1.5rem;
        }
        .feature-text {
            flex: 1;
        }
        .footer {
            background-color: #111827;
            color: #f3f4f6;
            padding: 3rem 0;
            margin-top: 4rem;
        }
        .footer-content {
            max-width: 1000px;
            margin: 0 auto;
            padding: 0 20px;
            text-align: center;
        }
        .footer a {
            color: #818cf8;
            text-decoration: none;
            transition: color 0.2s;
        }
        .footer a:hover {
            color: #a5b4fc;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero">
        <div class="content-wrapper text-center">
            <h1 class="hero-title">Spring Boot 自动配置</h1>
            <p class="hero-subtitle">深入解析 Spring Boot 自动配置机制的工作原理、核心组件及其实际应用</p>
            <div class="flex justify-center gap-4 mt-6">
                <span class="px-4 py-2 bg-white bg-opacity-10 rounded-full backdrop-blur-sm">
                    <i class="fas fa-cog mr-2"></i>自动配置
                </span>
                <span class="px-4 py-2 bg-white bg-opacity-10 rounded-full backdrop-blur-sm">
                    <i class="fas fa-magic mr-2"></i>条件注解
                </span>
                <span class="px-4 py-2 bg-white bg-opacity-10 rounded-full backdrop-blur-sm">
                    <i class="fas fa-bolt mr-2"></i>快速开发
                </span>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <div class="content-wrapper">
        <!-- Introduction -->
        <section>
            <p class="text-lg leading-relaxed text-gray-700 mb-8">
                <span class="text-3xl float-left mr-2 -mt-1 font-serif font-bold text-indigo-600 leading-none">S</span>
                pring Boot 是一款非常受欢迎的框架，能够快速构建基于 Spring 的应用。其核心理念之一是"自动配置"（Auto Configuration），即 Spring Boot 会根据开发环境自动选择合适的配置，以简化开发流程。在 Spring Boot 中，自动配置是其最大特点之一，使得开发者在无需配置的情况下即可快速上手。自动配置的核心原理是：基于应用的环境（类路径、配置文件等），自动配置所需的相关组件，极大地简化了 Spring 应用的开发过程。
            </p>
        </section>

        <!-- Section 1 -->
        <section>
            <h2 class="section-title">自动配置的核心概念</h2>
            <p class="text-gray-700 mb-6">Spring Boot 的自动配置功能让开发者无需在 <code class="px-2 py-1 bg-gray-100 rounded text-indigo-600">application.properties</code> 或 <code class="px-2 py-1 bg-gray-100 rounded text-indigo-600">application.yml</code> 中编写过多的配置。根据不同的条件，它会根据类路径的依赖、环境的不同等因素，自动加载不同的配置类，来帮助开发者减少配置的工作量。</p>

            <div class="grid md:grid-cols-2 gap-6">
                <!-- Card 1 -->
                <div class="card">
                    <h3 class="subsection-title"><i class="fas fa-code text-indigo-500 mr-2"></i>@EnableAutoConfiguration 注解</h3>
                    <p><code>@EnableAutoConfiguration</code> 注解是 Spring Boot 自动配置的核心。它的作用是启用 Spring Boot 的自动配置机制。</p>
                    <div class="code-block mt-4">
                        <span class="code-annotation">@Target</span>({<span class="code-annotation">ElementType</span>.<span class="code-keyword">TYPE</span>})<br>
                        <span class="code-annotation">@Retention</span>(<span class="code-annotation">RetentionPolicy</span>.<span class="code-keyword">RUNTIME</span>)<br>
                        <span class="code-annotation">@Import</span>(<span class="code-keyword">AutoConfigurationImportSelector</span>.<span class="code-keyword">class</span>)<br>
                        <span class="code-annotation">@Documented</span><br>
                        <span class="code-keyword">public</span> <span class="code-keyword">@interface</span> <span class="code-keyword">EnableAutoConfiguration</span> {<br>
                        &nbsp;&nbsp;<span class="code-comment">// 省略</span><br>
                        }
                    </div>
                    <p class="mt-4 text-gray-700"><code>@EnableAutoConfiguration</code> 会通过 <code>@Import(AutoConfigurationImportSelector.class)</code> 自动导入 <code>AutoConfigurationImportSelector</code> 类，从而导入一系列自动配置类。</p>
                </div>

                <!-- Card 2 -->
                <div class="card">
                    <h3 class="subsection-title"><i class="fas fa-link text-indigo-500 mr-2"></i>@EnableAutoConfiguration 与 @SpringBootApplication 的关系</h3>
                    <p><code>@SpringBootApplication</code> 注解实际上是组合注解，它包含了 <code>@EnableAutoConfiguration</code>，<code>@Configuration</code> 和 <code>@ComponentScan</code>。因此，<code>@SpringBootApplication</code> 让 Spring Boot 应用自动启用自动配置功能。</p>
                    <div class="code-block mt-4">
                        <span class="code-annotation">@SpringBootApplication</span><br>
                        <span class="code-keyword">public</span> <span class="code-keyword">class</span> <span class="code-keyword">Application</span> {<br>
                        &nbsp;&nbsp;<span class="code-keyword">public</span> <span class="code-keyword">static</span> <span class="code-keyword">void</span> <span class="code-keyword">main</span>(<span class="code-keyword">String</span>[] args) {<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;<span class="code-keyword">SpringApplication</span>.<span class="code-keyword">run</span>(<span class="code-keyword">Application</span>.<span class="code-keyword">class</span>, args);<br>
                        &nbsp;&nbsp;}<br>
                        }
                    </div>
                    <p class="mt-4 text-gray-700"><code>@EnableAutoConfiguration</code> 为核心，简化了开发者的配置步骤，自动扫描并加载所有符合条件的自动配置类。</p>
                </div>
            </div>
        </section>

        <!-- Section 2 -->
        <section>
            <h2 class="section-title">Spring Boot 自动配置的实现</h2>
            <p class="text-gray-700 mb-6">自动配置的实现依赖于 Spring 的条件注解和 <code>@Configuration</code> 配置类。自动配置类是一个标准的 Spring 配置类，它通常会加上 <code>@Configuration</code> 注解，并通过一系列条件注解来判断是否加载。</p>

            <div class="card">
                <h3 class="subsection-title"><i class="fas fa-check-circle text-indigo-500 mr-2"></i>条件注解（@Conditional 系列）</h3>
                <p>Spring Boot 自动配置的关键特性是条件注解。条件注解通过 <code>@Conditional</code> 注解的实现机制，判断是否满足特定的条件。如果条件成立，则加载自动配置类。常见的条件注解包括：</p>
                <div class="mt-4 grid md:grid-cols-2 gap-4">
                    <div class="p-4 bg-indigo-50 rounded-lg">
                        <div class="font-bold text-indigo-700 mb-2"><i class="fas fa-code mr-2"></i>@ConditionalOnClass</div>
                        <p>当类路径中包含指定类时，自动配置才会生效。</p>
                    </div>
                    <div class="p-4 bg-indigo-50 rounded-lg">
                        <div class="font-bold text-indigo-700 mb-2"><i class="fas fa-code mr-2"></i>@ConditionalOnMissingBean</div>
                        <p>当 Spring 容器中没有指定类型的 Bean 时，自动配置才会生效。</p>
                    </div>
                    <div class="p-4 bg-indigo-50 rounded-lg">
                        <div class="font-bold text-indigo-700 mb-2"><i class="fas fa-code mr-2"></i>@ConditionalOnProperty</div>
                        <p>当配置文件中指定的属性值满足时，自动配置才会生效。</p>
                    </div>
                    <div class="p-4 bg-indigo-50 rounded-lg">
                        <div class="font-bold text-indigo-700 mb-2"><i class="fas fa-code mr-2"></i>@ConditionalOnBean</div>
                        <p>当容器中已经有某个类型的 Bean 时，自动配置才会生效。</p>
                    </div>
                </div>

                <h3 class="subsection-title mt-6"><i class="fas fa-cogs text-indigo-500 mr-2"></i>AutoConfigurationImportSelector</h3>
                <p><code>AutoConfigurationImportSelector</code> 是 Spring Boot 自动配置的导入选择器，它实现了 <code>ImportSelector</code> 接口，负责在启动时根据条件选择和导入需要的自动配置类。<code>AutoConfigurationImportSelector</code> 会读取所有符合条件的自动配置类，并将其加载到 Spring 上下文中。</p>
                <div class="code-block mt-4">
                    <span class="code-keyword">public</span> <span class="code-keyword">class</span> <span class="code-keyword">AutoConfigurationImportSelector</span> <span class="code-keyword">implements</span> <span class="code-keyword">ImportSelector</span> {<br>
                    &nbsp;&nbsp;<span class="code-annotation">@Override</span><br>
                    &nbsp;&nbsp;<span class="code-keyword">public</span> <span class="code-keyword">String</span>[] <span class="code-keyword">selectImports</span>(<span class="code-keyword">AnnotationMetadata</span> importingClassMetadata) {<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;<span class="code-keyword">List</span>&lt;<span class="code-keyword">String</span>&gt; configurations = <span class="code-keyword">new</span> <span class="code-keyword">ArrayList</span>&lt;&gt;();<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;<span class="code-comment">// 查找符合条件的自动配置类</span><br>
                    &nbsp;&nbsp;&nbsp;&nbsp;<span class="code-keyword">for</span> (<span class="code-keyword">String</span> candidate : <span class="code-keyword">getCandidateConfigurations</span>(importingClassMetadata, <span class="code-keyword">null</span>)) {<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;configurations.<span class="code-keyword">add</span>(candidate);<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;}<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;<span class="code-keyword">return</span> configurations.<span class="code-keyword">toArray</span>(<span class="code-keyword">new</span> <span class="code-keyword">String</span>[0]);<br>
                    &nbsp;&nbsp;}<br>
                    }
                </div>
                <p class="mt-4 text-gray-700">在 <code>selectImports()</code> 方法中，<code>AutoConfigurationImportSelector</code> 会根据应用程序的环境、类路径以及条件注解来决定哪些自动配置类需要被加载。</p>
            </div>
        </section>

        <!-- Section 3 -->
        <section>
            <h2 class="section-title">Spring Boot 常见的自动配置类</h2>
            <p class="text-gray-700 mb-6">Spring Boot 提供了大量的自动配置类。以下是一些常见的自动配置类，它们的职责是自动配置与特定组件（如 Web 服务器、数据源等）相关的 Bean。</p>

            <div class="grid md:grid-cols-3 gap-6">
                <!-- Web Server -->
                <div class="card">
                    <div class="feature-icon">
                        <i class="fas fa-server text-xl"></i>
                    </div>
                    <h3 class="subsection-title">Web 服务器自动配置</h3>
                    <p>Spring Boot 默认会为 Web 应用提供嵌入式 Web 服务器（如 Tomcat、Jetty 或 Undertow）。以下是 Spring Boot 自动配置 Web 服务器的示例。</p>
                    <div class="code-block mt-4">
                        <span class="code-annotation">@Configuration</span><br>
                        <span class="code-annotation">@ConditionalOnClass</span>(<span class="code-keyword">Servlet</span>.<span class="code-keyword">class</span>)<br>
                        <span class="code-annotation">@ConditionalOnMissingBean</span>(<span class="code-keyword">WebServerFactory</span>.<span class="code-keyword">class</span>)<br>
                        <span class="code-keyword">public</span> <span class="code-keyword">class</span> <span class="code-keyword">WebServerFactoryAutoConfiguration</span> {<br>
                        &nbsp;&nbsp;<span class="code-annotation">@Bean</span><br>
                        &nbsp;&nbsp;<span class="code-keyword">public</span> <span class="code-keyword">TomcatServletWebServerFactory</span> <span class="code-keyword">webServerFactory</span>() {<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;<span class="code-keyword">return</span> <span class="code-keyword">new</span> <span class="code-keyword">TomcatServletWebServerFactory</span>();<br>
                        &nbsp;&nbsp;}<br>
                        }
                    </div>
                </div>

                <!-- DataSource -->
                <div class="card">
                    <div class="feature-icon">
                        <i class="fas fa-database text-xl"></i>
                    </div>
                    <h3 class="subsection-title">数据源自动配置</h3>
                    <p>Spring Boot 提供了自动配置数据源的能力。当类路径中存在 HikariCP 或其他数据库连接池时，Spring Boot 会自动配置数据源。</p>
                    <div class="code-block mt-4">
                        <span class="code-annotation">@Configuration</span><br>
                        <span class="code-annotation">@ConditionalOnClass</span>(<span class="code-keyword">DataSource</span>.<span class="code-keyword">class</span>)<br>
                        <span class="code-keyword">public</span> <span class="code-keyword">class</span> <span class="code-keyword">DataSourceAutoConfiguration</span> {<br>
                        &nbsp;&nbsp;<span class="code-annotation">@Bean</span><br>
                        &nbsp;&nbsp;<span class="code-annotation">@ConditionalOnMissingBean</span><br>
                        &nbsp;&nbsp;<span class="code-keyword">public</span> <span class="code-keyword">DataSource</span> <span class="code-keyword">dataSource</span>() {<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;<span class="code-keyword">return</span> <span class="code-keyword">new</span> <span class="code-keyword">HikariDataSource</span>(); <span class="code-comment">// 默认使用 Hikari 数据源</span><br>
                        &nbsp;&nbsp;}<br>
                        }
                    </div>
                </div>

                <!-- Message Middleware -->
                <div class="card">
                    <div class="feature-icon">
                        <i class="fas fa-exchange-alt text-xl"></i>
                    </div>
                    <h3 class="subsection-title">消息中间件自动配置</h3>
                    <p>如果应用引入了消息中间件的依赖（如 RabbitMQ、Kafka），Spring Boot 会自动配置与消息中间件相关的 Bean。</p>
                    <div class="code-block mt-4">
                        <span class="code-annotation">@Configuration</span><br>
                        <span class="code-annotation">@ConditionalOnClass</span>(<span class="code-keyword">RabbitTemplate</span>.<span class="code-keyword">class</span>)<br>
                        <span class="code-keyword">public</span> <span class="code-keyword">class</span> <span class="code-keyword">RabbitMQAutoConfiguration</span> {<br>
                        &nbsp;&nbsp;<span class="code-annotation">@Bean</span><br>
                        &nbsp;&nbsp;<span class="code-annotation">@ConditionalOnMissingBean</span><br>
                        &nbsp;&nbsp;<span class="code-keyword">public</span> <span class="code-keyword">RabbitTemplate</span> <span class="code-keyword">rabbitTemplate</span>() {<br>
                        &nbsp;&nbsp;&nbsp;&nbsp;<span class="code-keyword">return</span> <span class="code-keyword">new</span> <span class="code-keyword">RabbitTemplate</span>();<br>
                        &nbsp;&nbsp;}<br>
                        }
                    </div>
                </div>
            </div>
        </section>

        <!-- Section 4 -->
        <section>
            <h2 class="section-title">如何自定义自动配置</h2>
            <p class="text-gray-700 mb-6">Spring Boot 提供了很大的灵活性，允许开发者根据业务需求自定义自动配置。自定义自动配置的步骤如下：</p>

            <div class="card">
                <ol class="list-decimal list-inside space-y-4 text-gray-700">
                    <li class="pl-2">创建一个新的配置类，并使用 <code class="px-2 py-1 bg-gray-100 rounded text-indigo-600">@Configuration</code> 注解标注。</li>
                    <li class="pl-2">使用条件注解（如 <code class="px-2 py-1 bg-gray-100 rounded text-indigo-600">@ConditionalOnClass</code>、<code class="px-2 py-1 bg-gray-100 rounded text-indigo-600">@ConditionalOnProperty</code>）来控制该配置类的加载时机。</li>
                    <li class="pl-2">定义需要自动配置的 Bean，并通过 <code class="px-2 py-1 bg-gray-100 rounded text-indigo-600">@Bean</code> 注解声明。</li>
                </ol>

                <h3 class="subsection-title mt-6"><i class="fas fa-pen-fancy text-indigo-500 mr-2"></i>自定义自动配置类的示例：</h3>
                <div class="code-block">
                    <span class="code-annotation">@Configuration</span><br>
                    <span class="code-annotation">@ConditionalOnClass</span>(<span class="code-keyword">MyService</span>.<span class="code-keyword">class</span>)<br>
                    <span class="code-annotation">@ConditionalOnProperty</span>(name = <span class="code-string">"myapp.service.enabled"</span>, havingValue = <span class="code-string">"true"</span>)<br>
                    <span class="code-keyword">public</span> <span class="code-keyword">class</span> <span class="code-keyword">MyServiceAutoConfiguration</span> {<br>
                    <br>
                    &nbsp;&nbsp;<span class="code-annotation">@Bean</span><br>
                    &nbsp;&nbsp;<span class="code-keyword">public</span> <span class="code-keyword">MyService</span> <span class="code-keyword">myService</span>() {<br>
                    &nbsp;&nbsp;&nbsp;&nbsp;<span class="code-keyword">return</span> <span class="code-keyword">new</span> <span class="code-keyword">MyServiceImpl</span>();<br>
                    &nbsp;&nbsp;}<br>
                    }
                </div>
                <p class="mt-4 text-gray-700">在这个自定义自动配置类中，当 <code>myapp.service.enabled</code> 属性的值为 <code>true</code> 时，Spring Boot 会自动配置一个 <code>MyService</code> Bean。</p>
            </div>
        </section>

        <!-- Section 5 -->
        <section>
            <h2 class="section-title">自动配置的总结</h2>
            <div class="card">
                <div class="feature-item">
                    <div class="feature-icon">
                        <i class="fas fa-lightbulb text-xl"></i>
                    </div>
                    <div class="feature-text">
                        <p class="text-gray-700">Spring Boot 的自动配置机制是基于条件注解、自动配置类和条件导入选择器实现的。通过自动配置，开发者能够专注于应用的业务逻辑，而不需要编写繁琐的配置。自动配置根据当前的类路径、配置文件以及环境来动态加载合适的配置类，并提供自动化的 Bean 配置，极大地提高了开发效率。</p>
                    </div>
                </div>
                
                <div class="mt-6 p-6 bg-gradient-to-r from-indigo-50 to-purple-50 rounded-lg">
                    <h3 class="text-xl font-semibold text-indigo-700 mb-4">自动配置关键点总结</h3>
                    <ul class="space-y-3 text-gray-700">
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mr-2 mt-1"></i>
                            <span>自动配置通过条件注解实现按需加载</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mr-2 mt-1"></i>
                            <span><code>@EnableAutoConfiguration</code> 是自动配置的核心入口</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mr-2 mt-1"></i>
                            <span>Spring Boot 提供了大量内置的自动配置类</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mr-2 mt-1"></i>
                            <span>开发者可以自定义自动配置来满足特殊需求</span>
                        </li>
                        <li class="flex items-start">
                            <i class="fas fa-check-circle text-indigo-500 mr-2 mt-1"></i>
                            <span>自动配置大大简化了 Spring 应用的配置工作</span>
                        </li>
                    </ul>
                </div>
            </div>
        </section>
    </div>

    <!-- Footer -->
    <footer class="footer">
        <div class="footer-content">
            <h3 class="text-xl font-medium mb-2">技术小馆</h3>
            <p><a href="http://www.yuque.com/jtostring" target="_blank" rel="noopener noreferrer">www.yuque.com/jtostring</a></p>
        </div>
    </footer>

    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>